/*******************************************************************************
 * Copyright (c) 2008 Sylvain Sicard.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Sylvain Sicard - initial API and implementation
 ******************************************************************************/
/*
 * Created on 22 août 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package fr.jade.util.log.handler;

import java.io.PrintStream;
import java.util.LinkedList;

/**
 * @author Sylvain Sicard
 *
 */
public class MemoryHandler implements Handler{

	private Handler target;
	private LinkedList<String> logs;
	
	public MemoryHandler(Handler target){
		this.target = target;
		this.logs = new LinkedList<String>();
	}
	
	
	public void log(String msg) {
		logs.addLast(msg);
	}
	
	public void start() {
		//nothing to do
	}
	
	public void stop() {
		for(String s : logs){
			target.log(s);
		}
	}


  @Override
  public PrintStream getPrintStream() {
    // TODO Auto-generated method stub
    return null;
  }
}
